Added a better URI parser that is more flexible