Integrated #52 jhaygood86 patch

Integrated jhaygood86's patch for #52  (excluding the log4net stuff).

Commit history is a little messy as I tried to merge in the gist itself, but it wasn't very happy, ended up doing it manually.