added the previous search funtionality