update code to blog 1