Some improvements and fusion of API12 scripts