refactored analysis to function daily