Finished createType and auxiliary functions