Rework typeclasses for typed terms a bit.
Made the term language a bit less hacky.