Trigger a didRefreshEvent when the fields change

Also some minor refactorings.