Pre-allocated all the matrices