first draft of inline middleware