Replace collision, and moment code with version from my game.