First working version with beh simulation