Handle temp dirs better, generate temp files on the fly
Clean up snappy code a bit