detecting environment