Improve to support batch operation.