added limit to number of connections and added hostname resolution