Moved the function defs to their own file