factor out session path discovery