Refactor logger and utils, Add time span for initial query