Added functions to the service and some unit tests