Removing string return and adding in a type switch statement