cleaning up some device communication code