Added curly braces to if and for statements