fix search function
clean up and add comments
fix merge conflict
Merge pull request #82 from lpappone/master

(feature) fix search function