Implemented RestService test + some refactoring