New version with spare matrix