some restructuring
non-linearity fixed to tanh