Misc statelessness and formatting fixes, add class def type reference back again