added checkIfValid, used on HashSet<Transactions>