working version, valgrind says there are some issues, though
generate N.stop data