refactored structuring a bit
refactored controller code
refactor