mapping and writing files
a bit of a hack to get directory clean
working writes to files