Moved business logic into model