Fixed .qmail file parsing, split stuff out into functions