Refactor events controller