added debug mode.