reduce call of type() function to reduce overhead thanks LeafCage!
reduce type() more