moved fs into response function