TODO: note about sample randomization
main: fix file locking issue by spawning output handlers under the right conditions