Code cleanup: debug logging