Automate v3

Correction bug & simplification code