Corrected database calls
Added dns lookup as well.