updated all functions except the matrix one