Added curly braces to if-else statements