added tests for next function