Added a --debug flag to toggle debug output