Refactored search test and made other minor corrections