add comments and improve c# api