Fixed NuGet issue. And did some refactorings.