added auto-update code