Refactorices code and restructures project by including controller pattern.