optimize fugitive, condense helper function