reordered the code in the example