move logic from environment.py to BehaveController.py