Data extraction code