First draft of type handler code