Encapsulation of palladium crystallites in carbon and the formation of wormlike nanostructures