refactored model a bit