Update function almost done