rough test modularization
fixed merge conflicts; minor test restructuring