code for automation