Finish the data saving. Share the code

Signed-off-by: Hui Zheng <hzheng@wpi.edu>