The first example is a typical improvised melody. The second is much better!