helper for adding classes alternatively inside each statement