How does the auto-complete function work?