Implemented the sigmoid function