big time refactor, add unit tests and coverage reporting via grunt (qunit, istanbul)