Move related utility functions together.