Make it work with autocomplete

Rebase of #31