Added a small amount of error check
Includes device numbers for 3 devices