Added collision detection for edge of the map, now I really am off to bed.