nit: add braces for each if/else statement