remove some duplication from Session