Use Array instead of switch statement