improved formatting and fixed missing return from looptime