Adding reasons to document.sessionState. (Changing ByteString.Builder to ByteString.Lazy.Builder was necessary to make the code compile. Might need to be changed on a different system)