Added jasmine test library
Adding tests.
Fixing bug found by tests. Also, adding sanity check for number of rows.