Refactoring utility functions.