Fixed time(t) bug and cleaned the controllers