refactor to separate simple utilities from log scraper