refactored models class