Remove $gradient variable
because it is only used for once