Added a DEBUG switch variable to make debugging easier