added writing to file and extract among others
pre merge changes