model refactored as per instructions