Move debug to controller class