URL -> URI with some refactoring, based on work made by pgaschuetz
minor refactoring