added syntax checking