1. Search: Refactoring and fix smal bug