Refactor label engine to output correct format