Added support for cdn. I know its ugly.