Added sparse matrix support for wordbag scripts