Created class for nested transactions
Replaced normal transactions with nested transactions
Added transation over drain() batch

This should vastly improve performance.