Modify template code to reflect matrix cache for assignment