make debugging as  a global variable instead of a function parameter