improved speed of completions + minor bugfix
small refactoring