adding session management function and plugin