finished code with change notifications