Various improvements and bugfixes (Player flushBodies fix)

* Code style imrpovements
* Fix bug where contacts with the player are not properly ended when the player switches bodies

**See commit messages for specifics.**