- Refactored code to checkIfType(), checkIfListOfType()