Defining function to automatically find header