Adapted function applied to neruon output. Results are much better now