refactored user verification method