I think I had made a lot of these same cleanup changes in my actions/events branch. I made these checks use `defined`. But hopefully that'll get merged in to master in the next couple hours and then you can pull those changes back here.