Updated algorithm for automation process