handles forward searches
handles backwards searches