Add conditional checks and print