Added checking for undeclared functions