Cleanup
Improve efficiency if logging is disabled