Added main code.
Minor changes.