some minor additions, started nextpuzzle function