Added automation and a few code lines
Added automation and a few code lines