Add inverse for sigmoid function; manage invalid inputs; add to output the list of invalid inputs