added hard limit option for stopping