Improve the test coverage of services, controllers

Added more tests for services and controllers
Use brackets around `if` statements.