add batching and argument checking