search function added-- not pretty, but it works.