changed typeOf to be just a function