debugging, and clean up