Setting up main controller