added code to populate type fields