WIP: testing of next function; solve some TODOs