Search refactor

This is based from master and should be able to merge now.  Will wait till this one is merged before starting the next.