removed echo and changed operator from <= to <