[WIP] Transactional processing

Work on top of the refactor branch. Not really happy with the API yet.

@manygrams @manygrams @cyprusad