Refactoring and Remaining part done