Breaking out lines of classes and attaching them to elements