r2: cleanup the codebase