Refactored data processing, added code to the method recordUserActivities