@NathanielBennett is refactoring this in another branch