lots of iprovements on device controller and some basic testing