more elegant version of next/3, suggested by Jan