Revert "Revert "Bug fix and added search.""

This reverts commit aca3533a14d8432a9219a6518c730d77dda69a30.