improved dram refresh code