collision handling, and physics and logic restructuring