Cleaned up debug logic.