Got rid of that ugly switch statement