NAND Flash: Dealing With a Flawed Medium