separate out the code for session dependencies into its own function