Factored out part of boundary construction.