added sample for custom type. documented the type function