Thanks a lot Shinni, that worked.
The problem was that I wasn't validating whether any pin data had been added to the custom pin object before trying to traverse it. Plus the enable function not having its call also use the enable flag.
I knew it must have been something silly once you couldn't see why it wasn't working.