Implemented REST API access and refactored some test code.