Added sigmoid gradient function.