Factor out the Device class.