improve automated update script (not complete yet)