slight refactor, added more methods to API.