added self-update code