Added a bunch of unit testing code