removing a ridiculously ugly if statement