finish the user database function