formatting
added reference to tmp parameter for greater efficiency