Replace all the if's with a select case