Move SD card setup out of functions