Include inactive users in exports

+ a few small refactorings

@czue