Refactored code

Removed the service layer