Split out code into seperate files

@AButler - Is this what you wanted to do?