Move implementation into mini-libraries
test cleanup