completed controller and driver code for event listener