Adding if-else statement for kernel generation