Reset the configured projects count
Some refactoring to improve testability
Added some unit test coverage for existing behavior.