added generateUrl() method.