Optimized the GetDevice, and added a few supporting methods.

Added tests to confirm everything works as planned.