Refactoring and removal of unused files