Refactoring: general xforms library improvements