Cleanup of code
Move utility functions to a module "utils"