change list to tuple for faster creation lookup
replace "type()" usages with "isinstance()"