Main function complete.