Not a function error resolved