Added forkIO code. No idea if it's idiomatic