automatically quits when all callbacks are done, and some template stuff