abstract and clean up