moved im_type function to of