reorganize framing layer for clarity and avoiding deadlock