Copy of R's C50 package with patches to free memory