wip (store everything in TLS, reintroduce typeck)