basic code to retrieve the correct tag