Added code to check for obstructions, and tests