added function to convert switch statements to their if equivalents