Cleaned up the setData function so it checks for a transaction that is None automatically