Refactored some files