added braces for all if statements which didn't have one already
(K&R-style)