Read and write memory in blocks
Fix optimized read pass by running it later