added batch support and proper posting of data