reduced code in app delegate by removing unnecessary methods, and fixed type cast issue in main view controller to remove compiler warning.