Added some limit switch code.