Added code to slice data by environment