My own changes to the controller; should not be different from Haro's
Merged with Haro's controller fixes