added some comments and provided framework for search