Changed weight function to be defined through psi