added matrix test and updated heap