Add support for scanning/discovering new directories from current ones

Also added a few minor fixes/changes.