included new option for debug output and merged the two possible arrays into one