fixed some formatting and combined 2 if statements into 1