put brackets around nested ifs to clarify where the else belongs.