removed variable j, replaced with correct maxOverflow