no need to call Em.typeOf multiple times.
use a switch statement over if/else
use unless over if
remove redundant stuff.
Merge pull request #8 from jonnii/master

some refactoring