wave function stuff rewritten