script parsing and typing improved