Code review comments.

  - removed needless nested function
  - fixed potential bug with mutable value of keyword argument.
`data = data or {}` as an option