Refactoring and added NuGet package support. Closes #1