working on reworking environment into its own data structure