implemented sigmoid function