updated the controller again to not use the cursor