replaced most of `sprintf` with more compact `format`
updated test for nargs+append combination