Several improvements to AM03127 scripts