changing the code to accept url as parameter