refactor code on main controller
Merge pull request #18 from cmarkel5/refactor_code

refactor code on main controller