Added session protection

Added security regarding the use of sessions.