Implemented some utility functions.