refactor completion provider