Added the useful thinking bit of the autoupdate and tests.