added disk persistence + proper shutdown (hopefully)