moving to a switch case for better readability