Model cleanup and refactoring