splitting off session creation into its own function