Refactored out this overengineered shit.