Update function to modify arrray

Take the new element as a parameter.