Updated "newdevice" function with comments.

Tested on Ubuntu 14.04 Trusty.