Utility functions refactored.