Reworked an if statement