Switch object handling code to the Obstacles objects, and some other minor changes