Logic for sessionListner