move index parsing for task completion into its own function