Implemented a RESTAdapter and modified the code accordingly.