added debug flag
added verbose flag