refactored code to separate data paths for clarity before submission