OK, I can rewrite that later, I think @sigurdteigen wrote it originally.