improved logging and timestamp handling