Simplified a few calculations of this type: (360.0 / (x * 2.0)) == 180 / x Declaration and assignment of variables in one line. Use pre- instead of postfix de- and increments. Merged if condition checks. Added and removed newlines and brackets. Fixed indentation. Added TODO comments.