Optimized an if statement.