More refactoring (because why not I'm basically done and tired)