Improved main.