updated for multiple sessions