finished refactoring and testing models