avoid use 'type' variable name, this will shadow the orignal type