Updated controller.sv with correct functionality