Added typeof check