added --debug flag