Readded matrix generation