Here is a variation on a motive by Weber (B flat major) with figuration in middle part, as an exercise (ch64, 4.6) from the book 'Material used in Musical Composition (1909)' by the great professor Percy Goetschius. I learned everything I know on melody, harmony and counterpoint from 6 of his books (available for free on the web's archives). The key is to learn music like a language, experiencing rules and their licenses, through practice with a lot of exercises, which most books I have found don't offer. Although I am green at composition, I have completed over 1600 of his small exercises and a dozen larger (small inventions and this variation).