Refactored to .Net 4.0