Corrected some mistakes; improved sigmoidFunction()