Faster search, and fixed a few bugs.