added test limit switch code