Rewrite syntax handling to actually work properly