Modularized search.py

plus deleted some garbage comments