Minor cleanup & optimisation.
Refactored test code.
Added QueryTest and test_find().