Updated API interface so that it will be easy to write similar clients in other languages.