add update function and index