Save enviroment data in the class it self
Added controller check to enviroment
minor bug fixed