Delete obsolete code and tidy up some environment values.