test re-organization and code cleanup