keep gradients as separate functions (for now?)
finish repackaging nonlinearity?