Refactor code and enhance README.md file