implemented search function, untested.