Factored out licence detection mechanism