Code refactored and ReadMe added