Refactored controller code
Merge pull request #31 from CoderSpinoza/refactor

Refactored controller code