added custom autocompletion. minor refactoring