finished porting - library compiles but NOT tested