Putting function definition in the correct location