Instead of using is_X functions to determine the type, can use gettype on the object on switch on the returned type string instead.