removed some redundant code. more importantly, restored logistic() line 166 to < ... ( vs <= )