Adapting to a Changing Environment