refactored all the files