Decoder: Code refactoring on core, put some functions in decoder.utils + improve uri validity checking + add test for decoder.utils