using isinstance instead of type