Update cs_session_provider.js

some corrections and refactory.