added a simple debug mode