adding whitespaces; adding if
the missing if statements