Refactor output variables to be more generic