modified to use a fileMap instead of out and fileName options