RFC: Refactor search, fix a bug, and implement spelling correction