move plugin/theme prepping code closer to where it's used