updating and reformatting function