clean up and refactor to new factory api in pinkie