Improved readibility, refactored device detection using user agent
    and a litle improved performance reducing getSourceFlavorUrl calls