Comments added and underflow and out-of-bound needs to be added