put verification check in separate function