clean up impl of #726