Refining wave functions