Implemented most of the API ... seems to work.