cleaned up and commented fillHistoCollection subroutine
fixed loop error