Refactoring of session build