Started working on a DEBUG flag to help tracking down issues.
Updated some TODO/FIXME flags.
Merge remote-tracking branch 'origin/dev' into dev