with logging