Thread sandbox

This is a precursor to #69.