added feature for writing files related to different locations in the