Extract core device functionality to a library