fixed monstrous if statement