Added syntax error checking for functions