Optimize reflow by changing enums to traits and inlining more