Refacotring a bit, adding comments, can now write a real sst (probably)
Making sure that we don't need to keep any in memory state by introducing a temporary stream for data