Refactor utility functions, update README.md