Improved search performance

Fixes issue #281