uri: improve and clean-up interface, improve parser