Refactor out the model into a subpackage