refactored apply styles code into more generic methods outside of premailer