updated session handling and singleton management