Some formatting, logging, and bug fix for clear