readme and some refactoring.