Added ram.2.cor function and made several changes