fixed bugs
added more assertions
additional case of layout simplification
added LayoutBuilder::check() method
more tests