formatting, cleanup nested ifs