Added {} braces to if statement