Made map generation more robust, and made collision detection more
efficient.