Added documentation. Removed duplicated code from autocompletion module