Refactor updating notebook

refractored updating notebook
* try to remove double nested for-loop  (O(n^2)) as possible for performance
* remove duplicated actions (move paragraph while deleting paragraph)
* better readability