EC

I added functionality to check for the session and aligned code.