Added global debug switch. Closes #12.