Cleaned up code, fixed isRoot bug

isRoot does not work for filelist