Refactor record (document) loading

I have refactored the record loading which is now rather document
loading. Documents, because the metadata records are stored inside
the documents. Also started to design generic parts of the layout.

Signed-off-by: Konrad Reiche <konrad.reiche@gmail.com>
Small style changes

Just minimal style changes. Not more, not less.

Signed-off-by: Konrad Reiche <konrad.reiche@gmail.com>