adding netting functionality, not complete yet