Beginning to refactor into seperate files