managesessions function added