sources from ScottNZ modified to compile it in monodevelop 4.0