Boosted up matrix rendering and refactored the code.