Revised valve model.

This is for #205.