setTable now accepts a function to push the data
writeFunction now uses new setTable