variational part seems to work