Indexes: love your database
refactoring but I think I might redo this to be a whole lot less complex in the next commit