More refactoring, fixes to Heka logging