Implemented jbeda's suggestions, except s/stage/environment/g.