Worked out some bugs in the number chain, working correctly now