abstracting out environment settings - part 2, and fixing link and section sort