Tweaked code for AUTO