Better way of finding out if session terminated