Implement an update_device function. Fixes #2