add function to check if fields have changed