Added format methods and re-implemented print in terms of format.