(#1549) - move to opts-style args
(#1549) - ensure consistent value encoding