moved latch pin manipulation outside of for loop to support multi-byte shift out