This code was originally sourced from the Mono C# library. It is 
available under the X11 license
