Refactored code in main file and updated README.md.