Sort dict keys properly, add argspec to docstr