started moving logic into the models for testing