printf command and some tips

- Printf command get from http://phpjs.org/functions/sprintf and
adapted to be a command
- Some code cleanup