getting rid of expensive calls to printf