copy impl over from bung repo