refactoring
cleaned code and fixed tests
Merge branch 'feature/rest-refactoring' into develop