Clean some code, simplify multi-pane layout detection.
This fixes #3.