Refactored a few files