Moved device update logic into include file for reuse.