added database functionality to check email