Fixed tests, refactored controllers and services