added update middleware