Simplified and sped up the "type-function" example.