Better logic for updating