Loads of reworking

Signed-off-by: Lasse Bigum <lasse@bigum.org>