Almost total re-write of sparse.pl... WORKS