Refactoring and updated README.md