code formatting and fixed the order of boolean operands in if clause