The settings are the way they are because that code is from a much larger piece of code. I am utilizing 23 I/O pins, so those are the settings for those pins.

Since the larger portion of code was not working, I dumbed it down to see where my problem was. It's a lot easier for me to diagnose this way. I just can't figure out why it resets itself after the last command. I even put a loop at the end which would only exit after a button was pressed. It would hold there for one time and then after the button was pressed once, it would run through the sequencing and reset as stated earlier without holding in the hold loop.