Extract extraction code into separate function