now puts correct links in for prev and next