Some improvements to the extended set() operations. Renamed parameters for clarity and using encode_int.