Basic refactoring to domain objects, fixes #5