Improved Main.