Modify verify function to use database