CHG: extracting functions to their own fules