Rework the if's a bit