Refactored db search (generalized). Implemented image search.