added update() method for easy handling of ctxs

- tabified the code