Fix completely broken repin-on-connect behavior
Lots of closure annotation to allow JavaScript compile/verification.