Port to typeahead

Bit fiddly, will need refactoring