Factor the filesCode generation into a separate method.