Testing

Started writing some tests, factories, and doing some minor code refactoring.  Let me know what you think of where I'm going with things, so I know to continue or start working on other things.