refactored model
refactored controller and views