Updated extract script