split success and valid checks to seperate functions.