Add debug events & simplify template