undo, better MC detection, removed debugging code