Moved some functions to the utils module.