Reworked UI to use layouts in a more sensible way.

Also fixed bug where fields were not being cleared when loading documents with less columns than the last document.

Signed-off-by: Ephphatha <ephphatha@thelettereph.com>