Refractured Event Controller code