organize apply style logic into a single function