small changes, replaced sigmoid function