Added some number checks and more unit tests.