reverted c9467fb56d90b9cf19884535b3d2f6a388928c81
reverting 05edfb8b8da1b0204cdbc7a2fdc5e2b34055bc56
reverted 0e92a8d3686a40d3c0dab27fd920166dbb0330a8
added sparse median script, fixed some bugs