Added a way to check if session exists before creating one.