scanner refractoring, minor grammar update