Refactored code,files, with slight updates