rewritten dump script to be more convenient