Simplified the main controller