implemented debug mode