refactored models thoroughly