Moved event tracking to separate function now.