Changed logic for data extraction and finished bug fixes for transformation