added device header for global definitions, fixed all warnings