Memoized and renamed the main flask function; streamlined log parsing