Added ExtractRootPath() routine and bug fixes