code is done, fixed partRanges bug