Move functions to their own file