Debug mode, cleanup, and MINE PLACEMENT