Enhancing the REST API, fixing bugs (#341)