Refactoring to views. Added service layer