Refactoring model building