Refactor URL decoding for better testability