Some gameplay/collision resolution implementations, and minor refactoring.