Better update function