added syntax checking function