reduce casts
add tests for closure-compiler compilability
add required modules