Add boundaries. Simplify code.