Boundary conditions

Making this into a pull request to allow commenting, etc. Still premature to actually pull, but I think everyone involved knows that.