use traits to write the autocomplete method