Added Unit test and testability refactorings