Fixed bugs
Fixed few more bugs . Using batches for atomicity