Refactored various files