Change the if-else statements into a switch in ToxService

Refactoring -> #265.