refactored a lot and modified searching