Update README.md and some refactoring.