Allow overwriting variables

Couldn't you merge the range and the sorting into the `filterEnv` method? It seems silly to loop over `env` twice in succession, just to append it to a list.