Shorten an if statement