refactor code with API changes, update readme.