Set pin 13 as OUTPUT pin. Will use it to indicate the gear status.
Using pin 13 did not work out well. Now using pin 7. Works great!
Added comments and cleaned up code.