Fixes syntax errx errors with the ternary operator

Fixes local variable names

Defines the GEAR_RATIO constant