Add forking support

Closes #106, #500, #314