moved env.unpack from libraries to base functions