turn to commonjs module
fix ie8
completely rewritten
Merge branch 'dev'