moved next/prev code to bottom of page