Update extracting data

updated code