Improved URL validation