Refactor transaction class