added code to support unit tests as well as a unit test which is almost finished