Clean up lockscreen target configuration code (1/2)
Get rid of a lot of duplicated code.