try and be smart about generating url