added very crude (but working) collision control