:lipstick: refactor applyFlags