refactoring and remove unused files.