use name to decide type