Remove manually maintained switch-case statement

Replaced with a bit of metaprogramming thanks to reflection.fec