Converted to be compilable using .net 3.5