Updated URL handling to make it work