Factory reset wipe

Needs testing on the device, as I couldn't get it to work on the simulator.