added code to treat capilary pressure implicitly