Added some additional tests and typechecking.