Update name analysis code to use database