Added JUnit test and made minor changes to allow testing
More Unit testing