Updated to run on all input files and sectors