Refactored events controller and added comments