Upper bound check added