if statements condensed and trifiling formatting