cleaned up uri processing