further generalization and DRY-ing and css tweaks.