added debug enabled boolean
added debug messages