add dns cache, code is ugly fow now
added DNS cache, code may be a little ugly and need sanitization