added another switch function

added another switch function instead of all the else if's