Tested and bugfixed completion function
group-only complete test, refactorings