Refactoring js (session info)