createSession functionality