Improved the code.
refactored and improved the code.