Removed Mat.at, separated if