Display code triggering at the right time. Closes #507