Imporve base controller code