Fixed Main Controller code errors