Better programming
Replaced switch with func def hash.