Tidying up code.
Added main().