Fixed algorithm switch statement to account for type?