Fixed a few problems and added a queue/thread to background the work of turning pins on and off.