tried to clean up the log function