Refactored transaction API to allow access to internal transaction instance.