added and implemented --debug flag