moved the tx validation into its own function