Moving fetch to a separate function. Including time based search.