Refactoring and reorganizing file structure