Updated and refactored the code. Removed unused files