added test to models, refactored