REmoed i initialization from for loop; Moved device_id declaration out of #ifdef; Fixed makefile