Some refactoring and optimizations
Update README.md