implemented restful service, added tests