Added reinitialization if out of bound.
Changed some parameters.