more flexible code and improved docs
README.md update