Partially completed next and previous functions, needed more tests