Make the 'getCommonContainingDirectory' procedure work correctly for all corner cases.  More cleanup.