refactors result outputs to directive