refactored events controller