implemented a simple search with some conditions