huge update to catch up to C# version, untested. Only missing chain selection builder (you have to type the string yourself right now)