main class and controller