Refactored parse_transaction