changed logging function and output