Added flash read/write code