some code optimizations, README.md fix