Moved typecasting to its own module

Removed browser-compatability code, browserify is now required