Enforce thread safety at the type level

Closes #97

#121 should be merged before this one.