updated readme and some refactoring