Refactored more stuff