added generic update middleware

Close #5