Updated README.md, updated examples, code refactoring