added debug flag for testing