Started breaking things out into files and prepared for unit testing.