Added variable rootPath to accommodate different type of virtual path.