Refactored to use persistent objects - still need to refactor tests and clean up code