Split functions and test code into separate .c files