Added data extraction function