First implementation of format()