copy from io.codeplex.com