Added -d flag for setting device