Split code into separate files; Tested new changes and appear to work.