moved stuff to php
cleaned up some bugs
added search command