updated to handle all types of changes