Added comments to the stacking collection, and seperated the stacking manipulations from data writing. Added a queue for sequential data writing to disk.