Made many changes to xplsdk, and carried them over here