beginning to put in some variational stuff