added "mode" structure, added psi to it and replaced all instances of lp->psi with lp->mode->psi