Add proc to write files