Changed the implementation of the environment so it has less overhead.