added boolean for enabling debug mode