write factile definitions to file
refactor stats file
write exposure stats