Added some pretty crazy if statements from event.js